package com.shengzai

import java.io.{BufferedReader, FileReader}
import scala.io.Source

object Code05IO {
  def main(args: Array[String]): Unit = {
    // java
    val bufferedReader = new BufferedReader(new FileReader("hadoop_code/src/data/score.txt"))
    var lines :String = ""
    // 在Scala中不支持Java中while读取数据并判断的写法
    while ((lines=bufferedReader.readLine())!=null){
      println(lines)
    }
    bufferedReader.close()

    //scala
    val source = Source.fromFile("hadoop_code/src/data/score.txt")
    val strings = source.getLines()

    strings.foreach(println)
    source.close()



  }

}
